'''
svc模型，用于预测
'''
import math

from sklearn.model_selection import train_test_split
from sklearn.svm import SVC
from sklearn.datasets import load_iris


def svc():
    '''
    test_classifier
    :return: predict result and predict_proba
    '''
    # load data
    data = load_iris()
    # load model
    svc = SVC(probability=True)

    # for test to overcome over-fitting
    train_x, test_x, train_y, test_y = train_test_split(data.data, data.target, test_size=0.1, random_state=0)

    # train with data
    svc.fit(data.data, data.target)
    # predict
    # todo: analyse this
    a=svc.predict_proba(test_x)
    print(a)


if __name__ == '__main__':
    svc()
